<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>注册</title>
		<meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
		<!-- <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
		<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
		<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> -->
		<link rel="stylesheet" href="../lib/bootstrap.min.css">
		
		
	</head>
	<body>
		<style type="text/css">
			.container{ padding-top: 15px;}
			.col-xs-3 { line-height: 35px; color: #999; }
			.col-xs-8,.col-xs-4{ margin-left: 0; padding-left: 0;}
			.row{ padding-top: 8px; padding-bottom: 8px; border-bottom:1px #EAEAEA solid ;}
			.form-control{ color: #333 !important; border: none;}
			.yanzhengma{ line-height: 30px; padding: 0px 8px; border: 1px #EAEAEA solid; color: #000; z-index: 999; border-radius: 3px;
			 position: absolute; right: 25px; top: 10px;}
			 
			.form-control{ background: none !important;}
			.form-control:focus {border-color: #66afe9; outline: 0;-webkit-box-shadow: inset 0px 0px 5px #FFFFFF}	
			 .go{background: #ffa328; font-weight: 600; color: #FFFFFF; text-align: center; font-size: 1.6rem; padding: 10px 0; margin-top: 20px; border-radius: 5px;}
		</style>
		<div class="container">
			<div class="row">
				<div class="col-xs-3 col-xs-offset-1">手机号</div>
				<div class="col-xs-8"><input type="text" class="form-control" name="" id="shoujihao" placeholder="请输入手机号"/></div>
			</div>
			<div class="row" style="position: relative;">
				<div class="yanzhengma">验证码</div>
				<div class="col-xs-3 col-xs-offset-1">验证码</div>
				<div class="col-xs-4"><input type="text" class="form-control" name="" id="yanzhengma" value="" placeholder="测试输入1111" /></div>
			</div>
			<div class="row">
				<div class="col-xs-3 col-xs-offset-1">密码</div>
				<div class="col-xs-8"><input type="password" class="form-control" name="" id="password" value="" placeholder="请输入密码" /></div>
			</div>
			<div class="row">
				<div class="col-xs-3 col-xs-offset-1">确认密码</div>
				<div class="col-xs-8"><input type="password" class="form-control" name="" id="password2" value="" placeholder="请再次输入密码" /></div>
			</div>
			<div class="row">
				<div class="col-xs-3 col-xs-offset-1">推荐人</div>
				<div class="col-xs-8"><input type="text" class="form-control" name="" id="password2" value="" placeholder="推荐人手机号码" /></div>
			</div>
			<div class="row">
				<div class="col-xs-3 col-xs-offset-1">推荐码</div>
				<div class="col-xs-8"><input type="text" class="form-control" name="" id="password2" value="" placeholder="输入推荐码" /></div>
			</div>
			
			<div class="go">注册</div>
		</div>
		
		<script type="text/javascript" src="../lib/jquery.min.js"></script>
		<script type="text/javascript" src="../lib/bootstrap.min.js"></script>
		<script type="text/javascript" src="../lib/vue.min.js"></script>
		<script type="text/javascript" src="../lib/common.js"></script>
		<script type="text/javascript">

			var x = 60;
			function getx(){
				x = x-1;
				$(".yanzhengma").text("重新发送("+x+")");
				if(x == 0){
					$(".yanzhengma").text("验证码");
					$(".yanzhengma").on("click",function(){
						x = 60;
						getx();
						alert("给一个验证码");
					});
				}else{
					setTimeout("getx()",1000);
				}
			}
			$(".yanzhengma").click(function() {
				var shoujihao = $("#shoujihao").val();
				var js = "{'tel':"+shoujihao+"}";
				$(this).off("click");
				getx();
                $.ajax({
                    type: "POST",
                    url: "api/service",
                    beforeSend: function(request) {
                        request.setRequestHeader("req", "101");
                    },
                    dataType:"json",
                    data:js,
                    success: function(result) {
                        $(".hide1").text(result.resdata);
                    }
                });
            });
            $(".go").click(function(){
            	          
            	var yanzhengma = $("#yanzhengma").val();//验证码
            	
            	var password = $("#password").val();//密码
            	var password2 = $("#password2").val();//重复密码
            	
            	if(yanzhengma != ""){
            		if(password == password2 && password != ""){
					    var tel = $("#shoujihao").val();
					    var dcode = yanzhengma;
					    var password = password;

					     
            	       
					    				postJSON('/api/Test', {
					    		            // hello: "11223344",
					    		        }, function(result) {
					    		            console.log("成功", result);
					    		            // _this.text = result.status;
					    		        }, function(result) {
					    		            console.log("失败", result);
					    		        });
					    	

					    /*var zhucejs = "{'tel':"+tel+",'dcode':"+dcode+",'password':"+password+"}"
	            		$.ajax({
		                    type: "POST",
		                    url: "api/service",
		                    beforeSend: function(request) {
		                        request.setRequestHeader("req", "102");
		                    },
		                    dataType:"json",
		                    data:zhucejs,
		                    success: function(result) {
		                    	if(result.code == 1){
		                    		localStorage.setItem("tokenid", result.resdata.tokenid);
		                    		alert("注册成功");
		                    		window.location.href='index.html';
		                    	}else{
		                    		alert(result.errormsg)
		                    	}
		                    }
		                });*/
	            	}else{
	            		alert("密码输入不一致");
	            	}
            	}else{
            		alert("请输入验证码");
            	}
            })
		</script>
	</body>
</html>
